 <dd id="identifier_sn" style="float:right">
  <label>单据编号:</label>
  <span id="number" data-id={$sn}>{$sn}</span>
  <i id="editBills"></i>

  <span class="ui-combo-wrap ui-combo-active ctn-wrap" id="hide_change_sn"
  style="display: none;position: relative;overflow: visible;">
  <input type="text" class="input-txt" autocomplete="off" id="sn_input" value=""><i  class="trigger" id="choose_trigger_sn"></i>
  <div class="ui-droplist-wrap" id="droplist_sn" style="position: absolute; top: 30px; z-index: 1000; width: 100%; display: none; left: 0;">
    <div class="droplist" style="position: relative; overflow: auto; min-height: 150px; height: 150px;">
      <div class="list-item" onclick="change_sn()"></div>
    </div>
  </div>
</span>

</dd>

<script type="text/javascript">
  // 点击编辑单据编号
  $("#editBills").click(function () {
      var numberText=$("#number").attr("data-id");//单据号
      //console.log("numberText"+numberText);
      
      $("#sn_input").val(numberText);
      $("#droplist_sn .droplist .list-item").html(numberText);


      $("#editBills").hide();
      $("#number").hide();
      $("#hide_change_sn").show();


    });

  // 下拉选择
  function change_sn() {
    // console.log(value, text)

    var numberText=$("#number").text();
    // console.log(numberText);
    $("#sn_input").val(numberText);
    $("#droplist_sn").hide();

  }


    // 下拉选择
    $("#choose_trigger_sn").click(function () {
      $(this).next("#droplist_sn").toggle();
    });

  //选择框外点击则隐藏
  $(document).mouseup(function (e) {

    // console.log("AAA");

    if(e.target.id!="choose_trigger_sn"){
      if (e.target.id!="editBills") {
        if(e.target.id!="number"){


          var con = $("#hide_change_sn");   // 设置目标区域
          if (!con.is(e.target) && con.has(e.target).length === 0) {
           $("#hide_change_sn").hide();
            $("#editBills").show();
            $("#number").show();
            var sn_input = $("#sn_input").val()
            if (sn_input !="") {
              $("#number").html(sn_input);
              $("#number").attr("data-id",sn_input);
            }
          
          }
        }

      }

    } 
  });

  
</script>